<template>
  <base-info :chance-info="datas" />

  <item-title title="操作记录" />

  <operation-view :id="id" mode="chance" />

</template>

<script>
import baseInfo from '../../../chance/detail/modules/baseInfo'
import {defineComponent, getCurrentInstance, inject, onMounted, reactive, toRefs} from 'vue'

export default defineComponent({
  name: 'ChanceInfo',
  components: { baseInfo },
  props: {
    id: {
      type: Number,
      default: 0
    }
  },
  setup(props) {
    const currentInstance = getCurrentInstance()
    const api = inject('api')
    var data = reactive({
      datas: {}
    })

    onMounted(() => {
      api.chance.CHANCE_DETAIL(props.id).then((res) => {
        if (!res.code) {
          data.datas = res.data.ChanceInfo
        } else {
          currentInstance.proxy.customMessage({ type: 'error', message: res.msg })
        }
      })
    })

    return {
      ...toRefs(data),
    }
  }
})
</script>

<style scoped>

</style>
